/*
魔方是一种常见的玩具。2010年7月，美国加利福尼亚州科学家利用计算机证明任意组合的魔方均可以在20步之内还原。作为一个入门级的程序员，我们决定先写一个验证魔方是否复原的程序。对于魔方的一个操作，我们用一个字母来表示。将魔方的一个面正对玩家，就有了前后上下左右六个面，分别用F(Front)，B(Back)，U(Up)，D(Down) :，L(Left)，R(Right)来表示将这个面顺时针旋转90度，具体玩魔方的时候将右手覆盖到对应的面上，这六个操作时右手的旋转方向都是相同的。同时用X，Y，
Z，表示顺时针旋转中间一层，分别对应U，R，F。具体情况可以参照下图。与这九个操作对应的还有f, b, u, d, l, r, x, y, z，表示逆时针旋转。

现在我们给出一个操作序列，问在这么旋转之后，魔方是否和原来的时候完全一样。比如UXd被认为是不一样。
输入为一个长度不超过200的字符串，仅包含之上定义的18个字母。
如果能复原，输出Yes，否则输出No。

*/

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#if defined(_WIN32) && !defined(__cplusplus)
#define inline __inline
#endif



#include <stdio.h>
#include <string.h>

#define FACE_NUM 6
#define SUB_FACE_NUM 9


enum SixFace
{
	FaceFront = 0,
	FaceBack,
	FaceUp,
	FaceDown,
	FaceLeft,
	FaceRight,
};


static inline void RotateFaceClockwise(int face[SUB_FACE_NUM])
{
	int temp1 = face[0];
	face[0] = face[6];
	face[6] = face[8];
	face[8] = face[2];
	face[2] = temp1;

	int temp2 = face[1];
	face[1] = face[3];
	face[3] = face[7];
	face[7] = face[5];
	face[5] = temp2;
}

void OperateCube(int cube[FACE_NUM][SUB_FACE_NUM], char operateType)
{
	switch (operateType)
	{
		case 0:
		{
			for (int i = 0; i < FACE_NUM; i++)
			{
				for (int j = 0; j < SUB_FACE_NUM; j++)
				{
					cube[i][j] = i * 10 + j;
				}
			}
			break;
		}

		case 'U':
		{		
			RotateFaceClockwise(cube[FaceUp]);
			int temp[3] = {0};
			memcpy(temp, &cube[FaceFront][0], sizeof(temp));
			memcpy(&cube[FaceFront][0], &cube[FaceRight][0], sizeof(temp));
			memcpy(&cube[FaceRight][0], &cube[FaceBack][0], sizeof(temp));
			memcpy(&cube[FaceBack][0], &cube[FaceLeft][0], sizeof(temp));
			memcpy(&cube[FaceLeft][0], temp, sizeof(temp));
			break;
		}

		case 'R':
		{
			RotateFaceClockwise(cube[FaceRight]);

			int temp1 = cube[FaceFront][2];
			int temp2 = cube[FaceFront][5];
			int temp3 = cube[FaceFront][8];

			cube[FaceFront][2] = cube[FaceDown][2];
			cube[FaceFront][5] = cube[FaceDown][5];
			cube[FaceFront][8] = cube[FaceDown][8];

			cube[FaceDown][2] = cube[FaceBack][6];
			cube[FaceDown][5] = cube[FaceBack][3];
			cube[FaceDown][8] = cube[FaceBack][0];

			cube[FaceBack][6] = cube[FaceUp][2];
			cube[FaceBack][3] = cube[FaceUp][5];
			cube[FaceBack][0] = cube[FaceUp][8];

			cube[FaceUp][2] = temp1;
			cube[FaceUp][5] = temp2;
			cube[FaceUp][8] = temp3;

			break;
		}

		case 'F':
		{
			RotateFaceClockwise(cube[FaceFront]);

			int temp1 = cube[FaceUp][6];
			int temp2 = cube[FaceUp][7];
			int temp3 = cube[FaceUp][8];

			cube[FaceUp][6] = cube[FaceLeft][8];
			cube[FaceUp][7] = cube[FaceLeft][5];
			cube[FaceUp][8] = cube[FaceLeft][2];

			cube[FaceLeft][8] = cube[FaceDown][2];
			cube[FaceLeft][5] = cube[FaceDown][1];
			cube[FaceLeft][2] = cube[FaceDown][0];

			cube[FaceDown][2] = cube[FaceRight][0];
			cube[FaceDown][1] = cube[FaceRight][3];
			cube[FaceDown][0] = cube[FaceRight][6];

			cube[FaceRight][0] = temp1;
			cube[FaceRight][3] = temp2;
			cube[FaceRight][6] = temp3;

			break;
		}

		case 'D':
		{
			RotateFaceClockwise(cube[FaceDown]);
			int temp[3] = {0};
			memcpy(temp, &cube[FaceFront][6], sizeof(temp));
			memcpy(&cube[FaceFront][6], &cube[FaceLeft][6], sizeof(temp));
			memcpy(&cube[FaceLeft][6], &cube[FaceBack][6], sizeof(temp));
			memcpy(&cube[FaceBack][6], &cube[FaceRight][6], sizeof(temp));
			memcpy(&cube[FaceRight][6], temp, sizeof(temp));
			break;
		}

		case 'L':
		{
			RotateFaceClockwise(cube[FaceLeft]);

			int temp1 = cube[FaceFront][0];
			int temp2 = cube[FaceFront][3];
			int temp3 = cube[FaceFront][6];

			cube[FaceFront][0] = cube[FaceUp][0];
			cube[FaceFront][3] = cube[FaceUp][3];
			cube[FaceFront][6] = cube[FaceUp][6];

			cube[FaceUp][0] = cube[FaceBack][8];
			cube[FaceUp][3] = cube[FaceBack][5];
			cube[FaceUp][6] = cube[FaceBack][2];

			cube[FaceBack][8] = cube[FaceDown][0];
			cube[FaceBack][5] = cube[FaceDown][3];
			cube[FaceBack][2] = cube[FaceDown][6];

			cube[FaceDown][0] = temp1;
			cube[FaceDown][3] = temp2;
			cube[FaceDown][6] = temp3;

			break;
		}

		case 'B':
		{
			RotateFaceClockwise(cube[FaceBack]);

			int temp1 = cube[FaceUp][0];
			int temp2 = cube[FaceUp][1];
			int temp3 = cube[FaceUp][2];

			cube[FaceUp][0] = cube[FaceRight][2];
			cube[FaceUp][1] = cube[FaceRight][5];
			cube[FaceUp][2] = cube[FaceRight][8];

			cube[FaceRight][2] = cube[FaceDown][8];
			cube[FaceRight][5] = cube[FaceDown][7];
			cube[FaceRight][8] = cube[FaceDown][6];

			cube[FaceDown][8] = cube[FaceLeft][6];
			cube[FaceDown][7] = cube[FaceLeft][3];
			cube[FaceDown][6] = cube[FaceLeft][0];

			cube[FaceLeft][6] = temp1;
			cube[FaceLeft][3] = temp2;
			cube[FaceLeft][0] = temp3;

			break;
		}

		case 'X':
		{
			int temp[3] = {0};
			memcpy(temp, &cube[FaceFront][3], sizeof(temp));
			memcpy(&cube[FaceFront][3], &cube[FaceRight][3], sizeof(temp));
			memcpy(&cube[FaceRight][3], &cube[FaceBack][3], sizeof(temp));
			memcpy(&cube[FaceBack][3], &cube[FaceLeft][3], sizeof(temp));
			memcpy(&cube[FaceLeft][3], temp, sizeof(temp));

			break;
		}
		case 'Y':
		{
			int temp1 = cube[FaceFront][1];
			int temp2 = cube[FaceFront][4];
			int temp3 = cube[FaceFront][7];

			cube[FaceFront][1] = cube[FaceDown][1];
			cube[FaceFront][4] = cube[FaceDown][4];
			cube[FaceFront][7] = cube[FaceDown][7];

			cube[FaceDown][1] = cube[FaceBack][7];
			cube[FaceDown][4] = cube[FaceBack][4];
			cube[FaceDown][7] = cube[FaceBack][1];

			cube[FaceBack][7] = cube[FaceUp][1];
			cube[FaceBack][4] = cube[FaceUp][4];
			cube[FaceBack][1] = cube[FaceUp][7];

			cube[FaceUp][1] = temp1;
			cube[FaceUp][4] = temp2;
			cube[FaceUp][7] = temp3;

			break;
		}
		case 'Z':
		{
			int temp1 = cube[FaceUp][3];
			int temp2 = cube[FaceUp][4];
			int temp3 = cube[FaceUp][5];

			cube[FaceUp][3] = cube[FaceLeft][7];
			cube[FaceUp][4] = cube[FaceLeft][4];
			cube[FaceUp][5] = cube[FaceLeft][1];

			cube[FaceLeft][7] = cube[FaceDown][5];
			cube[FaceLeft][4] = cube[FaceDown][4];
			cube[FaceLeft][1] = cube[FaceDown][3];

			cube[FaceDown][5] = cube[FaceRight][1];
			cube[FaceDown][4] = cube[FaceRight][4];
			cube[FaceDown][3] = cube[FaceRight][7];

			cube[FaceRight][1] = temp1;
			cube[FaceRight][4] = temp2;
			cube[FaceRight][7] = temp3;

			break;
		}
	}

	// 逆时针相当于对应的顺时针三次
	if ('a' <= operateType && operateType <= 'z')
	{
		OperateCube(cube, operateType + 'A' - 'a');
		OperateCube(cube, operateType + 'A' - 'a');
		OperateCube(cube, operateType + 'A' - 'a');
	}
}

int main()
{
	char input[205];
	int cube[FACE_NUM][SUB_FACE_NUM];
	int cube2[FACE_NUM][SUB_FACE_NUM];
	OperateCube(cube, 0);
	memcpy(cube2, cube, sizeof(cube));

	scanf("%s", input);

	int len = strlen(input);
	for (int i = 0; i < len;i++)
	{
		OperateCube(cube, input[i]);
	}

	for (int i = 0; i < FACE_NUM; i++)
	{
		for (int j = 0; j < SUB_FACE_NUM; j++)
		{
			if(cube[i][j] != cube2[i][j])
			{
				printf("No\n");
				return 0;
			}
		}
	}

	printf("Yes\n");

	return 0;	
}
